package com.example.springboot.mapper;

import com.example.springboot.entity.Goods;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface GoodsMapper {

    @Select("SELECT * from sys_goods")
    List<Goods> findAll();

    //查找同一个订单申请采购的商品
    @Select("SELECT * from sys_goods where order_id = #{id}")
    List<Goods> selectByOrderId(Integer id);

    @Insert("insert into sys_goods(goods_name,goods_number,utility,order_id) " +
            "VALUES (#{goodsName},#{goodsNumber},#{utility},#{orderId});")
    int insert(Goods goods);

    int update(Goods goods);
}
